﻿Imports System.IO
Public Class medium
    Private Sub keys_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If (e.Control AndAlso (e.KeyCode = Keys.S)) Then
            Me.Button8_Click(sender, New System.EventArgs())
        End If
    End Sub
    'NOTE: Buttons that open office apps will not work for office 2013. Will need 'If 2010 exe exists, else run 2013 exe' to add support
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/winword.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/winword.exe")
        Else
            MsgBox("Word is not on this computer.")
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/powerpnt.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/powerpnt.exe")
        Else
            MsgBox("Powerpoint is not on this computer.")
        End If

    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        On Error Resume Next
        Dim url As String = "https://pilot.wright.edu"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        On Error Resume Next
        Dim url As String = "https://outlook.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        On Error Resume Next
        Dim weekselect As String
        Dim errormessage As String
        errormessage = "One of the database files is missing ... this usually is a sign of a serious bug. Please email kowal@innocent.com to report it. Include details about what you did at the time it occured."
        weekselect = File.ReadAllText("week/select.kwl")
        If weekselect = "" Then
            weekselect = "Week 1"
        Else

        End If
        'Period 1
        Dim FILE_NAME As String = "week/" + weekselect + "/P1Monday.kwl"
        If File.Exists(FILE_NAME) = True Then
            Dim objWriter As New StreamWriter(FILE_NAME)
            objWriter.Write(m1.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAME1 As String = "week/" + weekselect + "/P1Tusday.kwl"
        If File.Exists(FILE_NAME1) = True Then
            Dim objWriter As New StreamWriter(FILE_NAME1)
            objWriter.Write(tu1.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw1 As String = "week/" + weekselect + "/P1Wednesday.kwl"
        If File.Exists(FILE_NAME1) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw1)
            objWriter.Write(w1.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr1 As String = "week/" + weekselect + "/P1Thursday.kwl"
        If File.Exists(FILE_NAME1) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr1)
            objWriter.Write(tr1.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf1 As String = "week/" + weekselect + "/P1Friday.kwl"
        If File.Exists(FILE_NAME1) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf1)
            objWriter.Write(f1.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If
        ' Period 2
        Dim FILE_NAMEm2 As String = "week/" + weekselect + "/P2Monday.kwl"
        If File.Exists(FILE_NAMEm2) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEm2)
            objWriter.Write(m2.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtu2 As String = "week/" + weekselect + "/P2Tusday.kwl"
        If File.Exists(FILE_NAMEtu2) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtu2)
            objWriter.Write(tu2.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw2 As String = "week/" + weekselect + "/P2Wednesday.kwl"
        If File.Exists(FILE_NAMEw2) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw2)
            objWriter.Write(w2.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr2 As String = "week/" + weekselect + "/P2Thursday.kwl"
        If File.Exists(FILE_NAMEtr2) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr2)
            objWriter.Write(tr2.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf2 As String = "week/" + weekselect + "/P2Friday.kwl"
        If File.Exists(FILE_NAMEf2) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf2)
            objWriter.Write(f2.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If
        'Period 3
        Dim FILE_NAMEm3 As String = "week/" + weekselect + "/P3Monday.kwl"
        If File.Exists(FILE_NAMEm3) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEm3)
            objWriter.Write(m3.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtu3 As String = "week/" + weekselect + "/P3Tusday.kwl"
        If File.Exists(FILE_NAMEtu3) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtu3)
            objWriter.Write(tu3.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw3 As String = "week/" + weekselect + "/P3Wednesday.kwl"
        If File.Exists(FILE_NAMEw3) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw3)
            objWriter.Write(w3.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr3 As String = "week/" + weekselect + "/P3Thursday.kwl"
        If File.Exists(FILE_NAMEtr3) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr3)
            objWriter.Write(tr3.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf3 As String = "week/" + weekselect + "/P3Friday.kwl"
        If File.Exists(FILE_NAMEf3) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf3)
            objWriter.Write(f3.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If
        'Period 4
        Dim FILE_NAMEm4 As String = "week/" + weekselect + "/P4Monday.kwl"
        If File.Exists(FILE_NAMEm4) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEm4)
            objWriter.Write(m4.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtu4 As String = "week/" + weekselect + "/P4Tusday.kwl"
        If File.Exists(FILE_NAMEtu4) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtu4)
            objWriter.Write(tu4.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw4 As String = "week/" + weekselect + "/P4Wednesday.kwl"
        If File.Exists(FILE_NAMEw4) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw4)
            objWriter.Write(w4.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr4 As String = "week/" + weekselect + "/P4Thursday.kwl"
        If File.Exists(FILE_NAMEtr4) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr4)
            objWriter.Write(tr4.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf4 As String = "week/" + weekselect + "/P4Friday.kwl"
        If File.Exists(FILE_NAMEf4) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf4)
            objWriter.Write(f4.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If
        'Period 5
        Dim FILE_NAMEm5 As String = "week/" + weekselect + "/P5Monday.kwl"
        If File.Exists(FILE_NAMEm5) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEm5)
            objWriter.Write(m5.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtu5 As String = "week/" + weekselect + "/P5Tusday.kwl"
        If File.Exists(FILE_NAMEtu5) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtu5)
            objWriter.Write(tu5.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw5 As String = "week/" + weekselect + "/P5Wednesday.kwl"
        If File.Exists(FILE_NAMEw5) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw5)
            objWriter.Write(w5.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr5 As String = "week/" + weekselect + "/P5Thursday.kwl"
        If File.Exists(FILE_NAMEtr5) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr5)
            objWriter.Write(tr5.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf5 As String = "week/" + weekselect + "/P5Friday.kwl"
        If File.Exists(FILE_NAMEf5) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf5)
            objWriter.Write(f5.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If
        'Period 6
        Dim FILE_NAMEm6 As String = "week/" + weekselect + "/P6Monday.kwl"
        If File.Exists(FILE_NAMEm6) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEm6)
            objWriter.Write(m6.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtu6 As String = "week/" + weekselect + "/P6Tusday.kwl"
        If File.Exists(FILE_NAMEtu6) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtu6)
            objWriter.Write(tu6.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEw6 As String = "week/" + weekselect + "/P6Wednesday.kwl"
        If File.Exists(FILE_NAMEw6) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEw6)
            objWriter.Write(w6.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEtr6 As String = "week/" + weekselect + "/P6Thursday.kwl"
        If File.Exists(FILE_NAMEtr6) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEtr6)
            objWriter.Write(tr6.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEf6 As String = "week/" + weekselect + "/P6Friday.kwl"
        If File.Exists(FILE_NAMEf6) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEf6)
            objWriter.Write(f6.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Dim FILE_NAMEnotes As String = "week/" + weekselect + "/Notes.kwl"
        If File.Exists(FILE_NAMEnotes) = True Then
            Dim objWriter As New StreamWriter(FILE_NAMEnotes)
            objWriter.Write(notes.Text)
            objWriter.Close()
        Else
            MsgBox(errormessage)
        End If

        Button8.Hide()
        If Err.Number <> 0 Then
            MsgBox("A error occured:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, "DRSS Homework Manager")
        Else

        End If

    End Sub

    Public Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        ' NOTICE: This is for the "Load Saved Work" button, which was made invisible in dev .14. It is here as a 'unanticipated variable' fallback option.
        On Error Resume Next
        Dim weekselect As String
        weekselect = File.ReadAllText("week/select.kwl")
        If weekselect = "" Then
            weekselect = "Week 1"
        Else

        End If
        Button8.Show()
        m1.LoadFile("week/" + weekselect + "/P1Monday.kwl", RichTextBoxStreamType.PlainText)
        tu1.LoadFile("week/" + weekselect + "/P1Tusday.kwl", RichTextBoxStreamType.PlainText)
        w1.LoadFile("week/" + weekselect + "/P1Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr1.LoadFile("week/" + weekselect + "/P1Thursday.kwl", RichTextBoxStreamType.PlainText)
        f1.LoadFile("week/" + weekselect + "/P1Friday.kwl", RichTextBoxStreamType.PlainText)
        'Period 2
        m2.LoadFile("week/" + weekselect + "/P2Monday.kwl", RichTextBoxStreamType.PlainText)
        tu2.LoadFile("week/" + weekselect + "/P2Tusday.kwl", RichTextBoxStreamType.PlainText)
        w2.LoadFile("week/" + weekselect + "/P2Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr2.LoadFile("week/" + weekselect + "/P2Thursday.kwl", RichTextBoxStreamType.PlainText)
        f2.LoadFile("week/" + weekselect + "/P2Friday.kwl", RichTextBoxStreamType.PlainText)
        'Period 3
        m3.LoadFile("week/" + weekselect + "/P3Monday.kwl", RichTextBoxStreamType.PlainText)
        tu3.LoadFile("week/" + weekselect + "/P3Tusday.kwl", RichTextBoxStreamType.PlainText)
        w3.LoadFile("week/" + weekselect + "/P3Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr3.LoadFile("week/" + weekselect + "/P3Thursday.kwl", RichTextBoxStreamType.PlainText)
        f3.LoadFile("week/" + weekselect + "/P3Friday.kwl", RichTextBoxStreamType.PlainText)
        'Period 4
        m4.LoadFile("week/" + weekselect + "/P4Monday.kwl", RichTextBoxStreamType.PlainText)
        tu4.LoadFile("week/" + weekselect + "/P4Tusday.kwl", RichTextBoxStreamType.PlainText)
        w4.LoadFile("week/" + weekselect + "/P4Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr4.LoadFile("week/" + weekselect + "/P4Thursday.kwl", RichTextBoxStreamType.PlainText)
        f4.LoadFile("week/" + weekselect + "/P4Friday.kwl", RichTextBoxStreamType.PlainText)
        'Period 5
        m5.LoadFile("week/" + weekselect + "/P5Monday.kwl", RichTextBoxStreamType.PlainText)
        tu5.LoadFile("week/" + weekselect + "/P5Tusday.kwl", RichTextBoxStreamType.PlainText)
        w5.LoadFile("week/" + weekselect + "/P5Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr5.LoadFile("week/" + weekselect + "/P5Thursday.kwl", RichTextBoxStreamType.PlainText)
        f5.LoadFile("week/" + weekselect + "/P5Friday.kwl", RichTextBoxStreamType.PlainText)
        'Period 6
        m6.LoadFile("week/" + weekselect + "/P6Monday.kwl", RichTextBoxStreamType.PlainText)
        tu6.LoadFile("week/" + weekselect + "/P6Tusday.kwl", RichTextBoxStreamType.PlainText)
        w6.LoadFile("week/" + weekselect + "/P6Wednesday.kwl", RichTextBoxStreamType.PlainText)
        tr6.LoadFile("week/" + weekselect + "/P6Thursday.kwl", RichTextBoxStreamType.PlainText)
        f6.LoadFile("week/" + weekselect + "/P6Friday.kwl", RichTextBoxStreamType.PlainText)
        'Other
        notes.LoadFile("week/" + weekselect + "/Notes.kwl", RichTextBoxStreamType.PlainText)
        Button7.Hide()
        If Err.Number <> 0 Then
            MsgBox("A error occured:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, "DRSS Homework Manager")
        End If
    End Sub

    Private Sub tu2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu2.TextChanged    'slightly out of place
        Button8.Show()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        On Error Resume Next
        Dim url As String = "https://skydrive.live.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        about.Show()

    End Sub

    Private Sub Button11_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        If File.Exists("C:/WINDOWS/system32/calc.exe") Then
            System.Diagnostics.Process.Start("C:/WINDOWS/system32/calc.exe")
        Else
            MsgBox("The Calculator is not present on this computer.")
        End If
    End Sub

    Private Sub notes_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles notes.TextChanged
        Button8.Show()
    End Sub

    Private Sub m1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m1.TextChanged
        Button8.Show()
    End Sub

    Private Sub tu1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu1.TextChanged
        Button8.Show()
    End Sub

    Private Sub w1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w1.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr1.TextChanged
        Button8.Show()
    End Sub

    Private Sub f1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f1.TextChanged
        Button8.Show()
    End Sub

    Private Sub m2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m2.TextChanged
        Button8.Show()
    End Sub

    Private Sub w2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w2.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr2.TextChanged
        Button8.Show()
    End Sub

    Private Sub f2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f2.TextChanged
        Button8.Show()
    End Sub

    Private Sub m3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m3.TextChanged
        Button8.Show()
    End Sub

    Private Sub f3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f3.TextChanged
        Button8.Show()
    End Sub

    Private Sub w3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w3.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr3.TextChanged
        Button8.Show()
    End Sub

    Private Sub tu3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu3.TextChanged
        Button8.Show()
    End Sub

    Private Sub m4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m4.TextChanged
        Button8.Show()
    End Sub

    Private Sub tu4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu4.TextChanged
        Button8.Show()
    End Sub

    Private Sub f4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f4.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr4.TextChanged
        Button8.Show()
    End Sub

    Private Sub w4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w4.TextChanged
        Button8.Show()
    End Sub

    Private Sub m5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m5.TextChanged
        Button8.Show()
    End Sub

    Private Sub tu5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu5.TextChanged
        Button8.Show()
    End Sub

    Private Sub w5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w5.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr5.TextChanged
        Button8.Show()
    End Sub

    Private Sub f5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f5.TextChanged
        Button8.Show()
    End Sub

    Private Sub m6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m6.TextChanged
        Button8.Show()
    End Sub

    Private Sub f6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles f6.TextChanged
        Button8.Show()
    End Sub

    Private Sub w6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles w6.TextChanged
        Button8.Show()
    End Sub

    Private Sub tr6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tr6.TextChanged
        Button8.Show()
    End Sub

    Private Sub tu6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tu6.TextChanged
        Button8.Show()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/excel.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/excel.exe")
        Else
            MsgBox("Excel 2010 is not on this computer")
        End If
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

        Dim ofd As New OpenFileDialog
        With ofd
            .CheckFileExists = True
            .Filter = "Image Files (*.jpg)|*.jpg"
            .Title = "Change your planner's bakground image:"
            .ShowDialog()
        End With

        If DialogResult = Windows.Forms.DialogResult.OK AndAlso ofd.FileName <> "" Then

        Else
            Try
                If File.Exists(ofd.FileName) Then
                    Me.BackgroundImage.Dispose()
                    Me.BackgroundImage = Image.FromFile(ofd.FileName)
                    Me.BackgroundImageLayout = ImageLayout.Stretch
                Else

                    Exit Sub
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
                Debug.Print(ex.Message)
            End Try
            If ofd.FileName = "" Then
                Exit Sub
            Else

                Me.BackgroundImage.Save("background.jpg")

            End If

        End If
    End Sub


    Private Sub Msgbox_Yes_No()

    End Sub

    Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)

    End Sub
    Public Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        If e.Button = MouseButtons.Left Then
            Me.Show()
            sidebar.Close()
        End If
        If Me.WindowState = FormWindowState.Minimized Then
            Me.WindowState = FormWindowState.Maximized
            sidebar.Close()
        End If
        Me.BringToFront()
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As Object, _
                              ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        KHM.Main.ToolStripMenuItem1_Click_1(sender, New System.EventArgs())
    End Sub
    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Try
            If Me.WindowState = FormWindowState.Minimized Then
                Me.WindowState = FormWindowState.Minimized

                Me.Hide()
            End If
        Catch ex As Exception
        End Try
        If Me.WindowState = FormWindowState.Maximized Then
        Else
            If Me.Visible Then
            Else
                If CheckBox1.CheckState = CheckState.Checked Then
                    sidebar.Show()
                End If
            End If

        End If

    End Sub
    Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

    End Sub
    Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs)
        ' Do something if notifyicon's menu is shown
    End Sub

    Public Sub ToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exitmenuitem.Click
        On Error Resume Next
        If CheckBox1.CheckState = CheckState.Checked Then
            If File.Exists("settings.kwl") Then
            Else
                File.Create("settings.kwl")
            End If
        End If
        If CheckBox1.CheckState = CheckState.Unchecked Then
            If File.Exists("settings.kwl") Then
                File.Delete("settings.kwl")
            Else
            End If
        End If
        Me.Show()
        If Button8.Visible Then
            If MessageBox.Show("You may have unsaved changes. Would you like to save these changes?", "Save", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
                Button8.PerformClick()
                If Err.Number <> 0 Then
                    MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
                Else
                End If
                End
            End If
        End If
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
        End
    End Sub

    Private Sub PilotToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PilotToolStripMenuItem.Click
        On Error Resume Next
        Dim url As String = "https://pilot.wright.edu"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub EmailToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmailToolStripMenuItem.Click
        On Error Resume Next
        Dim url As String = "https://outlook.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub ContextMenuStrip1_Opening_1(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening

    End Sub

    Private Sub SkydriveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SkydriveToolStripMenuItem.Click
        On Error Resume Next
        Dim url As String = "https://skydrive.live.com"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub ProgressBookToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBookToolStripMenuItem.Click
        On Error Resume Next
        Dim url As String = "https://pb1.mdeca.org/parentaccess/General/LoginPage.aspx?DistrictID=224"
        Process.Start(url)
        If Err.Number <> 0 Then
            MsgBox("Something is wrong with your computer:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, )
        Else
        End If
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        weeks.Show()
    End Sub

    Private Sub WordToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WordToolStripMenuItem.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/winword.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/winword.exe")
        Else
            MsgBox("Word is not on this computer.")
        End If
    End Sub

    Private Sub PowerpointToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PowerpointToolStripMenuItem.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/powerpnt.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/powerpnt.exe")
        Else
            MsgBox("Powerpoint is not on this computer.")
        End If
    End Sub

    Private Sub ExcelToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExcelToolStripMenuItem.Click
        If File.Exists("C:/Program Files (x86)/Microsoft Office/Office14/excel.exe") Then
            System.Diagnostics.Process.Start("C:/Program Files (x86)/Microsoft Office/Office14/excel.exe")
        Else
            MsgBox("Excel 2010 is not on this computer")
        End If
    End Sub

    Private Sub CalculatorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculatorToolStripMenuItem.Click
        If File.Exists("C:/WINDOWS/system32/calc.exe") Then
            System.Diagnostics.Process.Start("C:/WINDOWS/system32/calc.exe")
        Else
            MsgBox("The Calculator is not present on this computer.(?!?!)")
        End If
    End Sub

    Private Sub NotifyToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ' NOTE: In dev. 14 and beyond, this sub has no purpose. It is remnants of the Notify system
        On Error Resume Next
        Dim weekselect As String
        weekselect = File.ReadAllText("week/select.kwl")
        If Today.DayOfWeek = DayOfWeek.Monday Then
            Dim mper1 As String
            Dim mper2 As String
            Dim mper3 As String
            Dim mper4 As String
            Dim mper5 As String
            Dim mper6 As String
            mper1 = File.ReadAllText("week/" + weekselect + "/P1Monday.kwl")
            mper2 = File.ReadAllText("week/" + weekselect + "/P2Monday.kwl")
            mper3 = File.ReadAllText("week/" + weekselect + "/P3Monday.kwl")
            mper4 = File.ReadAllText("week/" + weekselect + "/P4Monday.kwl")
            mper5 = File.ReadAllText("week/" + weekselect + "/P5Monday.kwl")
            mper6 = File.ReadAllText("week/" + weekselect + "/P6Monday.kwl")
            MsgBox("Things due Monday for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + mper1 + vbNewLine + "Period 2: " + mper2 + vbNewLine + "Period 3: " + mper3 + vbNewLine + "Period 4: " + mper4 + vbNewLine + "Period 5: " + mper5 + vbNewLine + "Period 6: " + mper6)
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Tuesday Then
            Dim tper1 As String
            Dim tper2 As String
            Dim tper3 As String
            Dim tper4 As String
            Dim tper5 As String
            Dim tper6 As String
            tper1 = File.ReadAllText("week/" + weekselect + "/P1Tusday.kwl")
            tper2 = File.ReadAllText("week/" + weekselect + "/P2Tusday.kwl")
            tper3 = File.ReadAllText("week/" + weekselect + "/P3Tusday.kwl")
            tper4 = File.ReadAllText("week/" + weekselect + "/P4Tusday.kwl")
            tper5 = File.ReadAllText("week/" + weekselect + "/P5Tusday.kwl")
            tper6 = File.ReadAllText("week/" + weekselect + "/P6Tusday.kwl")
            MsgBox("Things due Tuesday for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + tper1 + vbNewLine + "Period 2: " + tper2 + vbNewLine + "Period 3: " + tper3 + vbNewLine + "Period 4: " + tper4 + vbNewLine + "Period 5: " + tper5 + vbNewLine + "Period 6: " + tper6)
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Wednesday Then
            Dim wper1 As String
            Dim wper2 As String
            Dim wper3 As String
            Dim wper4 As String
            Dim wper5 As String
            Dim wper6 As String
            wper1 = File.ReadAllText("week/" + weekselect + "/P1Wednesday.kwl")
            wper2 = File.ReadAllText("week/" + weekselect + "/P2Wednesday.kwl")
            wper3 = File.ReadAllText("week/" + weekselect + "/P3Wednesday.kwl")
            wper4 = File.ReadAllText("week/" + weekselect + "/P4Wednesday.kwl")
            wper5 = File.ReadAllText("week/" + weekselect + "/P5Wednesday.kwl")
            wper6 = File.ReadAllText("week/" + weekselect + "/P6Wednesday.kwl")
            MsgBox("Things due Wednesday for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + wper1 + vbNewLine + "Period 2: " + wper2 + vbNewLine + "Period 3: " + wper3 + vbNewLine + "Period 4: " + wper4 + vbNewLine + "Period 5: " + wper5 + vbNewLine + "Period 6: " + wper6)
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Thursday Then
            Dim thper1 As String
            Dim thper2 As String
            Dim thper3 As String
            Dim thper4 As String
            Dim thper5 As String
            Dim thper6 As String
            thper1 = File.ReadAllText("week/" + weekselect + "/P1Thursday.kwl")
            thper2 = File.ReadAllText("week/" + weekselect + "/P2Thursday.kwl")
            thper3 = File.ReadAllText("week/" + weekselect + "/P3Thursday.kwl")
            thper4 = File.ReadAllText("week/" + weekselect + "/P4Thursday.kwl")
            thper5 = File.ReadAllText("week/" + weekselect + "/P5Thursday.kwl")
            thper6 = File.ReadAllText("week/" + weekselect + "/P6Thursday.kwl")
            MsgBox("Things due Thursday for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + thper1 + vbNewLine + "Period 2: " + thper2 + vbNewLine + "Period 3: " + thper3 + vbNewLine + "Period 4: " + thper4 + vbNewLine + "Period 5: " + thper5 + vbNewLine + "Period 6: " + thper6)
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Friday Then
            Dim fper1 As String
            Dim fper2 As String
            Dim fper3 As String
            Dim fper4 As String
            Dim fper5 As String
            Dim fper6 As String
            fper1 = File.ReadAllText("week/" + weekselect + "/P1Friday.kwl")
            fper2 = File.ReadAllText("week/" + weekselect + "/P2Friday.kwl")
            fper3 = File.ReadAllText("week/" + weekselect + "/P3Friday.kwl")
            fper4 = File.ReadAllText("week/" + weekselect + "/P4Friday.kwl")
            fper5 = File.ReadAllText("week/" + weekselect + "/P5Friday.kwl")
            fper6 = File.ReadAllText("week/" + weekselect + "/P6Friday.kwl")
            MsgBox("Things due Friday for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + fper1 + vbNewLine + "Period 2: " + fper2 + vbNewLine + "Period 3: " + fper3 + vbNewLine + "Period 4: " + fper4 + vbNewLine + "Period 5: " + fper5 + vbNewLine + "Period 6: " + fper6)
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Saturday Then
            MsgBox("What are you doing looking at this on a saturday?! Get a life!")
        Else

        End If
        If Today.DayOfWeek = DayOfWeek.Sunday Then
            Dim mper1 As String
            Dim mper2 As String
            Dim mper3 As String
            Dim mper4 As String
            Dim mper5 As String
            Dim mper6 As String
            mper1 = File.ReadAllText("week/" + weekselect + "/P1Monday.kwl")
            mper2 = File.ReadAllText("week/" + weekselect + "/P2Monday.kwl")
            mper3 = File.ReadAllText("week/" + weekselect + "/P3Monday.kwl")
            mper4 = File.ReadAllText("week/" + weekselect + "/P4Monday.kwl")
            mper5 = File.ReadAllText("week/" + weekselect + "/P5Monday.kwl")
            mper6 = File.ReadAllText("week/" + weekselect + "/P6Monday.kwl")
            MsgBox("Things due tomorrow for week: " + File.ReadAllText("week/select.kwl") + vbNewLine + "Period 1: " + mper1 + vbNewLine + "Period 2: " + mper2 + vbNewLine + "Period 3: " + mper3 + vbNewLine + "Period 4: " + mper4 + vbNewLine + "Period 5: " + mper5 + vbNewLine + "Period 6: " + mper6)
        Else

        End If
        If Err.Number <> 0 Then
            MsgBox("A error occured:" & vbCrLf & Err.Description & vbCrLf & Err.Source, vbOKOnly - vbExclamation, "DRSS Homework Manager")
        Else

        End If
    End Sub

    Private Sub NotifyToolStripMenuItem_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs)
        ' Don't know what this is, leaving for research later
    End Sub

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        On Error Resume Next

        If Err.Number <> 0 Then
        End If
    End Sub
End Class